<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title th:text="${resource.title + ' - 学习资源平台'}">资源详情 - 学习资源平台</title>
    <link rel="stylesheet" th:href="@{/css/common.css}">
    <link rel="stylesheet" th:href="@{/css/navbar.css}">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" th:href="@{/css/resourcedetail.css}">
</head>
<body>
<div class="container">
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a class="navbar-brand" href="#">云学堂</a>
            <div class="collapse navbar-collapse">
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <a class="nav-link active" th:href="@{/resource/list}">学习资源</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/assignment/list}">作业与考试</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/forum/list}">交流互动</a>
                    </li>
                    <li class="nav-item" th:if="${session.identity=='superAdmin' || session.identity=='ordinaryAdmin'}">
                        <a class="nav-link" th:href="@{/admin/index}">管理中心</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/user/digital}">个人中心</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" th:href="@{/user/logout}">退出</a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    <!-- 主内容 -->
    <div class="row mt-4">
        <div class="col-12">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a th:href="@{/resource/list}">学习资源</a></li>
                    <li class="breadcrumb-item active" th:text="${resource.title}">资源标题</li>
                </ol>
            </nav>
            
            <div class="card">
                <div class="card-header">
                    <h3 th:text="${resource.title}" class="resource-title">资源标题</h3>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-9">
                            <p><strong>资源描述:</strong></p>
                            <p th:text="${resource.description ?: '暂无描述'}">资源描述内容</p>
                            
                            <p><strong>专业分类:</strong> 
                                <span th:text="${major.majorName!=null?major.majorName: '未分类'}">专业名称</span>
                            </p>
                            
                            <p><strong>课程类型:</strong> 
                                <span th:text="${resource.type}">必修/选修</span>
                            </p>
                            
                            <p><strong>资源类型:</strong> 
                                <span th:text="${resource.resourceType}">资源类型</span>
                            </p>
                        </div>
                        
                        <div class="col-md-3">
                            <div class="card info-card">
                                <div class="card-body">
                                    <p><strong><i class="fas fa-info-circle me-2"></i>资源信息</strong></p>
                                    <p class="info-label">浏览次数:</p>
                                    <p><span class="stats-badge" th:text="${resource.viewCount}">0</span></p>
                                    
                                    <p class="info-label">下载次数:</p>
                                    <p><span class="stats-badge" th:text="${resource.downloadCount}">0</span></p>
                                    
                                    <p class="info-label">上传时间:</p>
                                    <p><span th:text="${#temporals.format(resource.createdTime, 'yyyy-MM-dd HH:mm')}">上传时间</span></p>
                                    
                                    <a th:href="@{'/resource/download/' + ${resource.id}}" class="btn btn-success">
                                        <i class="fas fa-download me-2"></i>下载资源
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>